import axios from "../utils/axios.js"
export let getList = ()=>{
   return (dispatch)=>{
        axios.get("/list").then(res=>{
            dispatch({
                type:"getList",
                payload:res.data.list
            })
        })
    }
}
export let addshop = (item)=>{
    return {
            type:"addshop",
            payload:item
        }  
    
}
export let addnum =(id)=>{
    return {
        type:"addnum",
        payload:id
    }
}
export let Del = (id)=>{
    return {
        type:"Del",
        payload:id
    }
}
export let checkitem = (id)=>{
    return {
        type:"checkitem",
        payload:id
    }
}
export let checkall = ()=>{
    return {
        type:"checkall"
    }
}
export let addAddress = (item)=>{
    console.log(item,22222222)
    return {
        type:"addAddress",
        payload:item
    }
}
export let editAddress = (item,ind) =>{
    console.log(item,ind,22222)
    return {
        type:'editAddress',
        payload:item,
        ind
    }
}
export let delshan = (ind)=>{
    console.log(ind,1234567)
    return {
        type:"delshan",
        payload:ind
    }
}
export let deladdress = (ind)=>{
    console.log(ind)
    return {
        type:"delshan2",
        payload:ind
    }
}
export let getPullList = (ispull)=>{
    return (dispatch)=>{
        axios.get("/list1").then(res=>{
            dispatch({
                type:"getPullList",
                payload:res.data.list,
                payload1:ispull
            })
        })
    }
}
export let getPinglunlist = ()=>{
    console.log(1);
    return (dispatch)=>{
        axios.get("/list2").then(res=>{
            dispatch({
                type:"getPinglunlist",
                payload:res.data.list,
            })
        })
    }
}
export let addShoucang = (id)=>{
    return {
        type:"addShoucang",
        payload:id
    }
}